package com.cf.r1039;

import java.io.*;
import java.util.Arrays;

public class a {

    static int MAXN = 51;
    static int[] arr = new int[MAXN];

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(br);
        PrintWriter out = new PrintWriter(System.out);
        in.nextToken();
        int t = (int) in.nval;
        while (t-- > 0) {
            in.nextToken();
            int n = (int) in.nval;
            Arrays.fill(arr, 0);
            for (int i = 0; i < n; i++) {
                in.nextToken(); int x = (int) in.nval;
                arr[x]++;
            }
            int sum0 = arr[0];
            int sum1 = arr[1];
            int ans = 0;
            if (sum0 > sum1) {
                ans += sum0 - sum1 + sum1 * 2;
            } else {
                ans += sum0 * 2 + sum1 - sum0;
            }
            for (int i = 2; i < arr.length; i++) {
                ans += arr[i] * i;
            }
            out.println(ans);
        }
        out.close();
        out.close();
        br.close();
    }
}